home *** CD-ROM | disk | FTP | other *** search
- Path: news.mistral.co.uk!usenet
- From: mikebarnard@mistral.co.uk (Mike Barnard)
- Newsgroups: comp.lang.c
- Subject: Re: Do you have ever pass structures?
- Date: Sat, 24 Feb 1996 16:19:36 GMT
- Organization: Mistral Internet (Brighton)
- Message-ID: <4gnlf2$1fh@news.mistral.co.uk>
- References: <4ge8mi$qjm@srvr1.engin.umich.edu>
- NNTP-Posting-Host: 194.73.212.177
- X-Newsreader: Forte Free Agent 1.0.82
-
- Hi.
-
- hasdi@news-server.engin.umich.edu (HASDI RODZMANN HASHIM) wrote:
-
- >MY QUESTION is do you ever pass the whole structures to a function
- >or you just pass a pointer to a function? For example, for a struct
- >of the following size...
-
- I'm new at this and not very good. But I have been reading on this
- subject ant it seems that if you pass the whole structure it takes a
- lot longer at the whole structure is copied onto the stack. If this is
- in a loop it could take up valuable code time. Also if you are for
- some reason close to the end of the stack you could overrun it and
- have a stack overflow error.
-
- If you pass a pointer only the value of the pointer is put on the
- stack. Saves much time and stack space.
-
- That seems to be the principle as I know it anyway. I repeat I'm new
- to this and there will probably be some details that are wrong.
-
- I'm trying to set up a menu for the front of a program using
- structures to hold the information about each menu choice and an array
- of such structures to hold the entire menu. To quote from my teaching
- book...
-
- "(Talking about pointers)...with this much fun who needs thier teeth
- drilled?"
-
-
- ---
- Mic.
- From windy and damp Worthing; England.
- mikebarnard@mistral.co.uk
-
- (I just lost 4 fence panels to the wind here! The cost of
- replacing them could have bought me a new windows compiler!)
-
-